<?php

class HomePage {

	function __construct($homePageID, $homePageHTML, $timestamp) {
			$this->homePageID = $homePageID;
			$this->homePageHTML = $homePageHTML;
			$this->timestamp = $timestamp;
		}
		
	var $homePageID;
	function get_homePageID () { return $this->homePageID; }
	
	var $homePageHTML;
	function get_homePageHTML () { return $this->homePageHTML; }
	
	var $timestamp;
	function get_timestamp () { return $this->timestamp; }
	
	function get_mostRecentHomepage()
	{
		include("inc/database.inc");
		
		$link = ConnectToDatabase2();
		$sql = "SELECT homepage_html, `insert_tstamp`, `id` from `home` where `insert_tstamp` IN (SELECT MAX(`insert_tstamp`) FROM `home`)";
		$result = RunSql($sql, $link);

		$row = mysql_fetch_assoc($result);

	    $this->homePageID = $row['id'];
		$this->homePageHTML = html_entity_decode(stripslashes($row['homepage_html']));
		$this->timestamp = $row['insert_tstamp'];
	}
}
?>